
<style>

    .roomsTab li{ display: inline-block; padding: 6px 12px; border: 1px solid #ccc; border-bottom: none; margin-right: -1px; cursor: pointer; margin-bottom: -1px}
    .roomsTab li.hover{ border-bottom: 1px solid #fff}
    .roomsTab { border-bottom: 1px solid #ccc; margin-bottom: 10px}
    .roomsContent{ display: none}
    #editor span{ min-width:0px}
    .add-phone,.delete-phone{ width: 30px;height: 30px; text-align: center;line-height: 30px; border-radius: 50%; background: #5BC0DE;display: inline-block; font-size: 16px; color: #fff; cursor: pointer; margin-left: 10px}
    .delete-phone{   border:1px solid #E53573; color: #E53573; background: #fff; font-weight: bold; line-height: 26px }

</style>


<script type="text/javascript" charset="utf-8" src="/static/libs/ue/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/libs/ue/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/libs/ue/lang/zh-cn/zh-cn.js"></script>
<div class="crumbs">
    <h3>新增活动 </h3><em class="c-666 ml10"></em>
    <p><a ui-sref="main.activity" >活动管理</a> > <a ui-sref="main.activity" >活动列表</a>  > 新增活动</p>
</div>


<div class="content-box "  style="display: none"  >
    <div class="form-inline form-group">


        <table class="input-table-default">
            <tr>
                <td><span>活动类型：</span></td>
                <td ng-init="dataInfo.type=0">
                    <select class="form-control" ng-options="v.code as v.desc for v in activityType" ng-model="dataInfo.type " ng-required="true" ng-blur="type =dataInfo.type==undefined"  ng-class="{err:type}"  ng-disabled="id"  >
                        <option value="">--选择场景--</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="width: 100%" colspan="2"><p class=" model-title mt50 block text-left  ">基本资料</p></td>
            </tr>
            <tr>
                <td><span>活动名称：</span></td>
                <td>
                    <input type="text" class="form-control " maxlength="30" size="60"  placeholder="名称2-30个字符以内，不能为纯数字" ng-model="dataInfo.name "  ng-pattern="pubRegex.reNumber"  ng-maxlength="30" ng-minlength="2"   ng-blur="name = !dataInfo.name "  ng-class="{err:name  }"   />
                </td>
            </tr>

            <tr>
                <td><span>活动副标题：</span></td>
                <td>
                    <input type="text" class="form-control " maxlength="50" size="80"   ng-blur="subtitle = !dataInfo.subtitle "  ng-class="{err:subtitle  }" ng-required="true"   placeholder="50个字符以内" ng-model="dataInfo.subtitle"  />
                </td>
            </tr>

            <tr>
                <td><span>活动场景：</span></td>
                <td>
                    <select class="form-control" ng-options="v.code as v.desc for v in activityScene" ng-model="dataInfo.scene " ng-required="true" ng-blur="scene  =!dataInfo.scene "  ng-class="{err:scene  }"   >
                        <option value="">--选择场景--</option>
                    </select>
                </td>
            </tr>

            <tr>
                <td><span class="v-top">活动封面：</span></td>
                <td>
                    <!---->
                    <div class="upimg-inline-block ">
                        <ul>
                            <li><button type="button"  class="btn btn-info " id="coverImage"> 上传图片<i></i> </button><i class="f12 c-999"></i><div class="img-show-box "></div><input type="hidden"  ng-model="dataInfo.coverImage" /></li>
                        </ul>
                    </div>
                    <!---->
                </td>
            </tr>


            <tr>
                <td><span>活动时间：</span></td>
                <td>
                    <div class="input-append date form_datetime_start inline-block" >
                        <i class="add-on pa mt30" ><i class="icon-th"></i></i>
                        <input class=" form-control " size="20" placeholder="起始时间" type="text"    onkeyup="this.value=''" id="beginTime" >
                    </div> ----
                    <div class="input-append date form_datetime_end inline-block" >
                        <i class="add-on pa mt30" ><i class="icon-th"></i></i>
                        <input class=" form-control " size="20" type="text"  placeholder="结束时间" onkeyup="this.value=''" id="endTime">
                    </div>
                    <input type="hidden" ng-class="{err:!dateThan==''}">
                    <i class="f12 c-red" >{{dateThan}}</i>
                </td>
            </tr>

            <tr>
                <td><span>活动地点：</span></td>
                <td>
                    <input type="text"   class="form-control" size="80" ng-model="dataInfo.location" ng-required="true" ng-blur="location =!dataInfo.location"  ng-class="{err:location }"  maxlength="50"  placeholder="详细地址不能为纯数字" ng-pattern="pubRegex.reNumber" />
                </td>
            </tr>

            <tr>
                <td><span>楼盘选择：</span></td>
                <td>
                    <input type="text" class="form-control"   placeholder="查找选择后自动获取" maxlength="30" size="50" readonly ng-model="dataInfo.buildingName " ng-blur="buildingName  =!dataInfo.buildingName "  ng-class="{err:buildingName  }">
                    <input type="hidden" ng-model="dataInfo.buildingId ">
                    <button type="button"  class="btn btn-info "    ng-click="dialogActivityBuilding()">获取楼盘<i></i> </button>
                </td>
            </tr>


            <tr>
                <td class="v-top"><span>活动内容：</span></td>
                <td >

                    <!--style给定宽度可以影响编辑器的最终宽度-->
                    <script id="editor" type="text/plain" style="width:940px;height:400px; overflow-x:hidden "></script>
                    <!--style给定宽度可以影响编辑器的最终宽度结束-->
                </td>
            </tr>

            <tr>
                <td><span>举办城市：</span></td>
                <td>
                    <select class="form-control" ng-options="v.id as v.name for v in cityTypes" ng-model="dataInfo.cityId " ng-required="true" ng-blur="cityId=!dataInfo.cityId "  ng-class="{err:cityId  }"   >
                        <option value="">--选择城市--</option>
                        <option value="-1">全部</option>
                    </select>

                </td>
            </tr>

            <tr>
                <td class="v-top"><span>绑定客服：</span></td>
                <td>
                    <input type="tel"  size="30" class="form-control"   maxlength="11"  ng-pattern="pubRegex.phone" ng-model="servicePhoneModel"  ng-blur="userPhone=!servicePhoneModel "  placeholder="请填写11位手机号码" />
                    <i ng-click="joinServicePhoneModel(servicePhoneModel)" class="add-phone" ng-if="(dataInfo.relativePhones.length)<10">+</i> <i class="f12 c-999">(选填，最多绑定10个电话号码)</i>
                    <em class=" f12 c-red">{{servicePhoneErr}}</em>

                    <div ng-repeat="d in dataInfo.relativePhones track by $index" class="mt5">
                        <input type="tel"  size="30" class="form-control"   maxlength="11"  ng-pattern="pubRegex.phone" ng-model="d"  ng-blur="userPhones=!d "  ng-disabled="true" placeholder="请填写11位手机号码" ng-class="{err:userPhones }"/>
                        <i class="delete-phone v-top" ng-click="DelServicePhoneModel(d,$index)">-</i>
                    </div>
                </td>
            </tr>


        </table>

    </div>



    <div class="form-inline form-group">
        <p class=" model-title mt50 block  " >入场券设置</p>
        <table class="input-table-default">
            <tr>
                <td><span>入场券名称：</span></td>
               <td>
                   <select class="form-control"  ng-options="v.id as v.name for v in couponNames" ng-model="dataInfo.couponId"   >
                       <option value="">请选择入场券名称</option>
                   </select>
               </td>
            </tr>

            <!--<tr>-->
                <!--<td><span>是否收费：</span></td>-->
                <!--<td ng-init="dataInfo.coupon.charge=true">-->
                    <!--<select class="form-control"    ng-init="charges=[{code:true,desc:'是'},{code:false,desc:'否'}]" ng-options="v.code as v.desc for v in charges" ng-model="dataInfo.coupon.charge" ng-required="true" ng-blur="charge =dataInfo.coupon.charge==null"  ng-class="{err:charge }"  >-->
                        <!--<option value="">&#45;&#45;选择类型&#45;&#45;</option>-->
                    <!--</select>-->
                <!--</td>-->
            <!--</tr>-->

            <!--<tr ng-if="dataInfo.coupon.charge==true">-->
                <!--<td><span>价格：</span></td>-->
                <!--<td>-->
                    <!--<input type="text" class="form-control " size="10" ng-minlength="0"  maxlength="8" placeholder="0.00" ng-model="dataInfo.coupon.price"  ng-blur="price = !dataInfo.coupon.price||dataInfo.coupon.price>10000" ng-pattern="pubRegex.price"  ng-class="{err:price}" /> <i class="f12 c-999">( 元，金额不超过10000元)</i>-->
                <!--</td>-->
            <!--</tr>-->


            <!--<tr>-->
                <!--<td><span>有效期：</span></td>-->
                <!--<td>-->
                    <!--<div class="input-append date form_datetime_start inline-block" >-->
                        <!--<i class="add-on pa mt30" ><i class="icon-th"></i></i>-->
                        <!--<input class=" form-control " size="20" placeholder="起始时间" type="text"    onkeyup="this.value=''" id="beginTime2" >-->
                    <!--</div> &#45;&#45;&#45;&#45;-->
                    <!--<div class="input-append date form_datetime_end inline-block" >-->
                        <!--<i class="add-on pa mt30" ><i class="icon-th"></i></i>-->
                        <!--<input class=" form-control " size="20" type="text"    placeholder="结束时间" onkeyup="this.value=''" id="endTime2">-->
                    <!--</div>-->
                    <!--<input type="hidden" ng-class="{err:!dateThan2==''}">-->
                    <!--<i class="f12 c-red" >{{dateThan2}}</i>-->
                <!--</td>-->
            <!--</tr>-->
        </table>
    </div>

    <div class="text-center" style="margin-bottom: 100px"><input type="hidden" ng-model="dataInfo.id"/><button type="button" class="btn btn-primary mt50 "  ng-click="submit([dataInfo,true])"  style="width: 160px;">保存</button></div>



    <div class="form-inline form-group mt50" ng-if="buildingLayouts">
        <p class=" model-title mt50 block  " style="border-bottom: none; margin-bottom:0px">虚拟样板间设置<i class="f12 c-red ml10">(注：设置虚拟样板间之前请保存活动基本信息！)</i></p>
        <table class=" table   table-hover table-condensed  table-striped text-center " style=" width: 97%;margin-left: 20px" >
            <thead style="background:#8A8BC4; color: #fff">
            <tr>
                <td>ID</td>
                <td>户型名称</td>
                <td>户型</td>
                <td>面积（平方米）</td>
                <td>户型图</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="g in buildingLayouts" class="v-mid">
                <td ng-bind="g.id" class="v-mid"></td>
                <td ng-bind="g.name" class="v-mid"></td>
                <td class="v-mid">{{g.bedroom}}室{{g.livingRoom}}厅{{g.toilet}}卫</td>
                <td ng-bind="g.houseArea" class="v-mid"></td>
                <td>
                    <a class="preview-img cursor"><img ng-src="{{g.layoutImage}}&imageView2/1/w/40/h/40"   data-target=".myModal" data-toggle="modal"  data-img="{{g.layoutImage}}"></a>
                </td>
                <td  class="v-mid">
                    <button   class="btn btn-primary btn-xs" ng-click="createDialog([g.id])"  >管理虚拟样板间（{{getCaseCount(g.id)||0}}）</button>
                </td>
            </tr>
            </tbody>
        </table>
    </div>


</div>

<div ng-include="'/templates/partial/show-img.html'"></div>




<!--dialog-->
<div class="modal fade myModalActivityBuilding" >
    <div class="modal-dialog " style="width: 1000px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">选择楼盘</h4>
            </div>
            <div class="modal-body">
                <div class="dialog-content f12  lh200">
                    <table class=" table   table-hover table-condensed  table-striped text-center ">
                        <thead style="background:#8A8BC4; color: #fff">
                        <tr>
                            <td>ID</td>
                            <td style="min-width: 100px">楼盘名称</td>
                            <td>楼盘地址</td>
                            <td>开发商</td>
                            <!--<td style="min-width: 100px">装修标准</td>-->
                            <td>操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="g in grid.result" >
                            <td ng-bind="g.id"></td>
                            <td ng-bind="g.name"></td>
                            <td ng-bind="g.address"></td>
                            <td ng-bind="g.developer"></td>
                            <!--<td><i ng-if="g.decoration===1">毛坯</i><i ng-if="g.decoration===2">精装</i></td>-->
                            <td>
                                <button  class="btn btn-primary btn-xs " ng-click=chooseActivityBuilding([g.id,g.name])>选择</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div ng-include="'/templates/partial/page.html'" style="height: 50px;background-color: #f4f4f6"></div>
                </div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->



<!--dialog-->
<div class="modal fade createDialog" >
    <div class="modal-dialog " style="width: 1000px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">虚拟样板间</h4>
            </div>
            <div class="modal-body">
                <div class="roomsTab">
                    <ul><li class="hover" ng-click="ChooseCasecheckedStatus()">选择虚拟样板间</li><li ng-click="changeChooseCaseList()">已选择虚拟样板间（<i>{{chooseCasesCount||0}}</i>）</li></ul>
                </div>
                <div class="dialog-content roomsContent f12  lh200" style="display: block">
                    <div class="mb10">
                        <input type="text" class="form-control input-sm inline-block"  style="width: 20%" placeholder="制作公司" maxlength="30" size="30" ng-model="list.companyName">
                        <input type="text" class="form-control input-sm inline-block" style="width: 20%"  placeholder="作品名称" maxlength="30" size="30" ng-model="list.caseName">
                        <button type="button" class="btn btn-primary btn-sm inline-block " ng-click="submitSearch(list)"> 查询</button>
                    </div>
                    <table class=" table   table-hover table-condensed  table-striped text-center ">
                        <thead style="background:#8A8BC4; color: #fff">
                        <tr>
                            <td style="width: 40px;">选择</td>
                            <td style="width: 24px;">ID</td>
                            <td>制作公司</td>
                            <td>作品名称</td>
                            <td>风格</td>
                            <td>户型</td>
                            <td>面积（平方米）</td>
                            <td>状态</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="g in grid.result" on-module-finished>
                            <td> <input type="checkbox" value="{{g.caseId}}" class="checkbox-list"/></td>
                            <td ng-bind="g.caseId"></td>
                            <td ng-bind="g.companyName"></td>
                            <td ng-bind="g.caseName"></td>
                            <td ng-bind="g.caseStyle"></td>
                            <td>{{g.bedroom}}室{{g.livingRoom}}厅{{g.toilet}}卫</td>
                            <td>{{g.houseArea}}</td>
                            <td>{{g.statusDesc}}</td>
                        </tr>
                        </tbody>
                    </table>

                    <div ng-include="'/templates/partial/page.html'" style="height: 50px;background-color: #f4f4f6"></div>


                </div>


                <div class="dialog-content  roomsContent f12  lh200">
                    <table class=" table   table-hover table-condensed  table-striped text-center ">
                        <thead style="background:#8A8BC4; color: #fff">
                        <tr>
                            <td style="width: 24px;">ID</td>
                            <td>制作公司</td>
                            <td>作品名称</td>
                            <td>风格</td>
                            <td>户型</td>
                            <td>面积（平方米）</td>
                            <td>状态</td>
                            <td>操作</td>
                            <h1>{{chooses}}</h1>
                        </tr>
                        </thead>
                        <tbody>
                        <tr ng-repeat="g in chooseCaseList"  ng-model="chooseCaseList" >
                            <td ng-bind="g.caseId"></td>
                            <td ng-bind="g.companyName"></td>
                            <td ng-bind="g.caseName"></td>
                            <td ng-bind="g.caseStyle"></td>
                            <td>{{g.bedroom}}室{{g.livingRoom}}厅{{g.toilet}}卫</td>
                            <td>{{g.houseArea}}</td>
                            <td>{{g.statusDesc}}</td>
                            <td><button  class="btn btn-warning btn-xs " ng-click=delChooseCaseList([g.caseId])>删除</button></td>
                        </tr>
                        </tbody>
                    </table>
                </div>

                <div class="modal-footer">
                    <input type="hidden" ng-model="dialogDataInfo.id" />
                    <button type="button" class="btn btn-primary "  ng-click="createDialogSumbit()" >确定</button>
                </div>

            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
